package day03;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class A03_李四Servlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("李四执行");
        //public RequestDispatcher getRequestDispatcher(String path);
        //李四找王五的路径
        //请求调度对象: 请求转发和请求包含
        //RequestDispatcher类中的方法
        // include(ServletRequest request, ServletResponse response)
        // forward(ServletRequest request, ServletResponse response)
        RequestDispatcher rd = req.getRequestDispatcher("/wwServlet1");
        //请求转发 forward  李四找王五干活
        rd.forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
          doGet(req, resp);
    }
}
